<template>
  <el-dialog title="打印" :visible.sync="openOne" width="800px" append-to-body :before-close="close">
    <div v-if="list" id="printMe" class="main1">
      <div class="title">
        <!--        <p class="zi2">总页号：<font><span tdata="pageNO">第##页</span>/<span tdata="pageCount">共##页</span></font>-->
        <!--        </p>-->
        <!--        <img src="/uploads/print/logo.png" class="logo">-->
        <p class="zi1">中外运物流有限公司</p>
      </div>
      <div style="float:left;width:555px;">
        <p class="title2">INBOUND TALLY SHEET</p>
      </div>
      <div class="name" style="margin-bottom: 10px;">基本信息</div>
      <div class="area">
        <div class="column">
          <p class="zi1">电商订单号:</p>
          <p class="zi2">{{ list.orderId }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">订单时间:</p>
          <p class="zi2">{{ list.orderDate }}</p>
        </div>
        <div class="column">
          <p class="zi1">实付款:</p>
          <p class="zi2">{{ list.realPayment }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">商品金额:</p>
          <p class="zi2">{{ list.amount }}</p>
        </div>
        <div class="column">
          <p class="zi1">代扣税款:</p>
          <p class="zi2">{{ list.tax }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">运杂费:</p>
          <p class="zi2">{{ list.distributionfee }}</p>
        </div>
        <div class="column">
          <p class="zi1">非现金抵扣:</p>
          <p class="zi2">{{ list.discount }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">币制:</p>
          <p class="zi2">{{ list.currency }}</p>
        </div>
        <div class="column">
          <p class="zi1">支付交易编号:</p>
          <p class="zi2">{{ list.payOrderNo }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">订购人:</p>
          <p class="zi2">{{ list.buyerName }}</p>
        </div>
        <div class="column">
          <p class="zi1">订购人证件号:</p>
          <p class="zi2">{{ list.ConsigneeCode }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">收货人:</p>
          <p class="zi2">{{ list.distributionfee }}</p>
        </div>
        <div class="column">
          <p class="zi1">收货人电话:</p>
          <p class="zi2">{{ list.contactMobile }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">收货地址:</p>
          <p class="zi2">{{ list.contactAddr }}</p>
        </div>
        <div class="column">
          <p class="zi1">详细地址:</p>
          <p class="zi2">{{ list.detailAddr }}</p>
        </div>
        <div class="column column2">
          <p class="zi1">邮政编码:</p>
          <p class="zi2">{{ list.postcode }}</p>
        </div>
        <div class="column">
          <p class="zi1">备注:</p>
          <p class="zi2">{{ list.note }}</p>
        </div>
      </div>
      <div v-if="list" class="form">
        <hr style="float:left;width:555px;margin-top:5px;">
        <div class="name" style="margin-bottom: 10px;">平台信息</div>
        <div class="area">
          <div class="column">
            <p class="zi1">电商平台代码:</p>
            <p class="zi2">{{ list.ebpCode }}</p>
          </div>
          <div class="column column2">
            <p class="zi1">电商平台名称:</p>
            <p class="zi2">{{ list.ebpName }}</p>
          </div>
          <div class="column">
            <p class="zi1">支付企业代码:</p>
            <p class="zi2">{{ list.paycomCode }}</p>
          </div>
          <div class="column column2">
            <p class="zi1">支付企业名称:</p>
            <p class="zi2">{{ list.paycomName }}</p>
          </div>
          <div class="column">
            <p class="zi1">电商企业代码:</p>
            <p class="zi2">{{ list.ebcCode }}</p>
          </div>
          <div class="column column2">
            <p class="zi1">电商企业名称:</p>
            <p class="zi2">{{ list.ebcName }}</p>
          </div>
          <hr style="float:left;width:555px;margin-top:5px;">
          <div class="name" style="margin-bottom: 10px;">回执信息</div>
          <div class="column">
            <p class="zi1">订单状态:</p>
            <p class="zi2" v-if="list.push_order == '0'">未推送</p>
            <p class="zi2" v-if="list.push_order == '1'">已推送</p>
            <p class="zi2" v-if="list.push_order == '2'">电子口岸申报中</p>
            <p class="zi2" v-if="list.push_order == '3'">发送海关成功</p>
            <p class="zi2" v-if="list.push_order == '4'">发送海关失败</p>
            <p class="zi2" v-if="list.push_order == '100'">海关退单</p>
            <p class="zi2" v-if="list.push_order == '120'">海关入库</p>
          </div>
          <div class="column column2">
            <p class="zi1">回执信息:</p>
            <p class="zi2">{{ list.error_msg }}</p>
          </div>
        </div>
        <hr style="float:left;width:555px;margin-top:5px;">
        <div class="name" style="margin-bottom: 10px;">商品信息</div>
        <table class="collapsed">
          <thead>
            <tr>
<!--              <th>账册备案料号</th>-->
              <th>电商平台品名</th>
              <th>海关登记品名</th>
              <th>海关编码</th>
              <th>条形码</th>
              <th>商品数量</th>
              <th>单价</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(itme,index) in list.goodsListStr" :key="index">
<!--              <td>{{ itme.RecordMaterialNo }}</td>-->
              <td>{{ itme.goods_name }}</td>
              <td>{{ itme.g_name }}</td>
              <td>{{ itme.g_code }}</td>
              <td>{{ itme.barcode }}</td>
              <td>{{ itme.num }}</td>
              <td>{{ itme.price }}</td>
            </tr>
<!--            <tr v-for="(item,index) in list.goodsListStr.length">-->
<!--              <td style="height: 35px;" />-->
<!--              <td style="height: 35px;" />-->
<!--              <td style="height: 35px;" />-->
<!--              <td style="height: 35px;" />-->
<!--              <td style="height: 35px;" />-->
<!--              <td style="height: 35px;" />-->
<!--            </tr>-->
          </tbody>
        </table>
      </div>
<!--      <hr style="float:left;width:555px;margin-top:5px;">-->
<!--      <div class="tail">-->
<!--        <div class="nr1">-->
<!--          <p class="zi1">创建人:</p>-->
<!--          <p class="zi2">{{ list.username }}</p>-->
<!--        </div>-->
<!--        <div class="nr1">-->
<!--          <p class="zi1">创建时间:{{ list.created_at }}</p>-->
<!--          <p class="zi2" />-->
<!--        </div>-->
<!--        <div class="nr1">-->
<!--          <p class="zi1">收货人:</p>-->
<!--          <p class="zi2" />-->
<!--        </div>-->
<!--        <div class="nr1">-->
<!--          <p class="zi1">收货时间:</p>-->
<!--          <p class="zi2" />-->
<!--        </div>-->
<!--      </div>-->
    </div>
    <el-row style="top: 30px;margin-bottom: 30px;text-align:center;">
      <el-col :span="24">
        <el-button v-print="'#printMe'" type="primary" size="medium">打印</el-button>
      </el-col>
    </el-row>
  </el-dialog>
</template>
<script>
import { orderInfo } from '@/api/order'
export default {
  name: 'Print',
  props: {
    openOne: {
      type: Boolean
    },
    orderId: {
      type: String
    }
  },
  data() {
    return {
      list: []
    }
  },
  watch: {
    'openOne': function(newValue, oldValue) {
      if (newValue === true) {
        this.printList()
      }
    }
  },
  methods: {
    printList() {
      const that = this
      const data = {
        orderId: this.orderId,
        type: 1
      }
      orderInfo(data).then(response => {
        if (response.code === 10000) {
          that.list = response.data
        }
      })
    },
    close() {
      this.$emit('update:openOne', false)
    }
  }
}
</script>
<style lang="scss" scoped>
img {
    width: 100%;
    float: left;
}

p {
    padding: 0;
    margin: 0;
    font-family: 宋体
}

div {
    font-family: 宋体;
}

.main1 {
    width: 555px;
    background: #fff;
    padding: 0px 20px;
    margin:auto;
}

.title {
    float: left;
    width: 555px;
    border-bottom: 2px solid #000;
    padding: 10px 0px;
}

.title .logo {
    float: left;
    width: 116px;
    height: 30px;
}

.title .zi1 {
    float:right;
    line-height: 30px;
    font-size: 18px;
    color: #000;
}
.title .zi2 {
    float:right;
    line-height: 30px;
    font-size: 14px;
    color: #999;
    width:555px;
    text-align:right;
}

.title2 {
    float: left;
    line-height: 40px;
    font-size: 18px;
    color: #970000;
}

.title2-1 {
    float:right;
    height: 40px;
    width:200px;
}

.area {
    float: left;
    width: 555px;
}

.area p {
    font-size: 11px;
    line-height: 24px;
}

.area .column {
    float: left;
    width: 272.5px;
    margin-right: 10px;
    margin-bottom: 5px;
}

.area .column .img1{float:left;width:200px;height:40px;margin-left:10px;}

.area .column2 {
    margin-right: 0;
}

.area .zi1 {
    float: left;
    border-bottom: 1px solid #fff;
    width: 100px;
}

.area .zi2 {
    float: left;
    //border-bottom: 1px solid #000;
    width: 160.5px;
    margin-left: 10px;
}

.form {
    float: left;
    width: 555px;
    margin-top: 10px;
}

.form .name {
    float: left;
    width: 555px;
    font-size: 14px;
    line-height:30px;
}

table,
td,
th {
    padding: 3px;
    border: 1px solid #aaa;
    text-align: center;
    font-size: 12px;
    line-height: 18px;
}

th {
    font-weight: bold;
}

.separate {
    border-collapse: separate;
}

.collapsed {
    border-collapse: collapse;
    width: 555px;
}

.tail {
    float: left;
    width: 555px;
    margin-top: 5px;
    margin-bottom: 20px;
}

.tail .nr1 {
    float: left;
    width: 277.5px;
    font-size: 10px;
    line-height: 18px;
}

.tail .nr1 p {
    float: left;
}

.tail .nr1 .zi2 {
    margin-left: 5px;
}
</style>

